<!--
 * @Descripttion: 
 * @version: 
 * @Author: Mr. Xu
 * @Date: 2020-12-15 08:57:28
 * @LastEditors: Mr. Xu
 * @LastEditTime: 2020-12-18 17:41:46
-->
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>预约列表</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="robots" content="noindex,nofollow" />
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/common.css" media="all">
  <style>
    .layui-form-item{
      width: 600px;
    }
	.layui-layer-content img {
	    border: none;
	    width: 100%;
	}
  </style>
</head>

<body class="page-body">
  <h2 class="comm-title">预约列表</h2>
  <div class="layui-tab">
    <ul class="layui-tab-title page-tab-title">
      <li class="layui-this">预约列表</li>
      <li><a href="{:url('add')}">新增</a></li>
    </ul>
  </div>
  <div class="tpcms-body-div page-main">
	<form class="layui-form serch new-form" method="post">
		<div class="layui-form-item" style="float: left;">
		  <div class="layui-input-inline">
			<input type="text" name="keywords" lay-verify="title" autocomplete="off" placeholder="请输入客户姓名或手机号"  class="layui-input layui-btn-sm">
		  </div>
		  <div class="layui-input-inline">
			<div class="layui-inline">
			  <div class="layui-input-inline">
				<input type="text" class="layui-input" id="seach_time" placeholder="创建时间" name="seach_time">
			  </div>
			</div>
		  </div>
		  <button type="button" class="layui-btn layui-btn-danger layui-btn-sm search-btn">搜索</button>
		</div>
	  </form>
    <div class="page-table">
      <table id="tables" lay-filter="datas"></table>
    </div>
	
	<script type="text/html" id="Anlages">
		查看附件
	</script>
	<script type="text/html" id="status1">
		{{# if(d.is_grade==1) {}}
			已立项
		{{# }else{ }}
			暂未立项
		{{# } }}
	</script>
	
	<script type="text/html" id="status">
		{{# if(d.status==0) {}}
			待确定
		{{# }else if(d.status==1){ }}
			进行中
		{{# }else if(d.status==2){ }}
			已完成
		{{# } }}
	</script>
	<script type="text/html" id="barDemo">
		<a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="look_info">预约详情</a>
		<!-- <a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="yuyue_info">预约详情</a> -->
		<!-- <a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="speed">进度详情</a>
		<a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="report">汇报记录</a> -->
		
		
		{{# if(d.is_allot==0) {}}
		<!-- 0指派给测量1指给团队 -->
			{{# if (d.status==0 && d.is_grade==0) { }}
			<a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="jieshou">确定接收</a>
			{{# }else{ }}
			<!-- <a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="baojia">指派报价</a> -->
			{{# } }}
			{{# if (d.offer_info.status==4) { }}
				{{# if (d.x_status!=1) { }}
					<a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="z_team">指派团队</a>
				{{# } }}
			{{# }else{ }}
				<!-- <a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="baojia">指派报价</a> -->
			{{# } }}
		{{# }else{ }}
			<!-- {{# if (d.offer_info.status==4) { }}
				{{# if (d.x_status!=1) { }}
					<a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="z_team">指派团队</a>
				{{# } }}
			{{# }else{ }}
				 <a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="baojia">指派报价</a> 
			{{# } }} -->
		{{# } }}
		
		{{# if (d.is_baojia==1) { }}
		<a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="baojia">指派报价</a>
		{{# } }}


		{{# if (d.offer_info.status==1) { }}
		<!-- 管理员审核报价 -->
		<a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="offer">审核报价</a>
		{{# } }}
		
		
    	<!--预约详情里面显示用户提交的所有信息，以及图片-->
    	
		<!--   处理指派给测量，然后在指派给报价，在审核报价
		{{# if (d.status==2 && d.is_grade==0) { }}
		  <a href="javascript:;" class="layui-btn layui-btn-xs a_menu layui-btn-primary btn-edit" lay-event="offer">审核报价</a>
		{{# } }}
		-->
		
		<!--  处理指派给团队
			
		-->
	</script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script src="__PUBLIC__/layui/layui.js"></script>

    <script type="text/javascript">
    var lists = [[{ 
              field: 'id', 
              title: '序号', 
              width: 60,
              type:'numbers',
            }, { 
              field: 'order', 
              title: '订单号',
              width: 160 
            },{ 
              field: 'u_mobile', 
              title: '预约账号', 
              width: 120 
            }, { 
              field: 'name', 
              title: '客户姓名', 
              width: 80 
            }, { 
              field: 'mobile', 
              title: '手机号', 
              width: 120 
            }, { 
              field: 'staff_type_name', 
              title: '预约项目',
              width: 120 
            },   { 
              field: 'status', 
              title: '预约状态', 
			  toolbar: '#status',
              width: 80 
            },{ 
              field: 'status', 
              title: '项目状态', 
			  toolbar: '#status1',
              width: 80 
            },{ 
				field: 'jindu_name', 
				title: '当前进度', 
				width: 100 
            }, { 
              field: 'add_time', 
              title: '创建时间', 
              width: 150,
              templet:"<div>{{layui.util.toDateString(d.add_time*1000, 'yyyy-MM-dd HH:mm:ss')}}</div>"
            }, { 
              title: '操作', 
              width: 200, 
              fixed:'right',
              toolbar: '#barDemo' 
            }]];
      layui.use(['table','laydate','form'], function () {
        var table = layui.table,form=layui.form,
        laydate = layui.laydate;
        laydate.render({
          elem: '#seach_time',
          type: 'datetime',
          range: '~'
        });
        table.on('tool(datas)', function (obj) {
			var data = obj.data;
      
      if (obj.event === 'z_team') {
				layer.open({
				  title:false
				  , shadeClose: true
				  , shade: 0.5
				  , type: 2,
				  skin:"open_allview"
				  , area: ['30%',	'60%']
				  , content: "{:url('z_team')}?id=" + data.id
				});
			}
      if (obj.event === 'baojia') {
				layer.open({
				  title:false
				  , shadeClose: true
				  , shade: 0.5
				  , type: 2,
				  skin:"open_allview"
				  , area: ['30%',	'60%']
				  , content: "{:url('baojia')}?id=" + data.id
				});
			}
			if (obj.event === 'jieshou') {
				layer.open({
				  title:false
				  , shadeClose: true
				  , shade: 0.5
				  , type: 2,
				  skin:"open_allview"
				  , area: ['30%',	'60%']
				  , content: "{:url('receive')}?id=" + data.id
				});
			}
			if (obj.event === 'speed') {
				layer.open({
				  title:false
				  , shadeClose: true
				  , shade: 0.5
				  , type: 2,
				  skin:"open_allview"
				  , area: ['60%',	'60%']
				  , content: "{:url('speed')}?id=" + data.id
				});
			}

			
			// yuyue_info 预约详情
			
			if (obj.event === 'yuyue_info') {
				layer.open({
				  title:false
				  , shadeClose: true
				  , shade: 0.5
				  , type: 2,
				  skin:"open_allview"
				  , area: ['60%',	'60%']
				  , content: "{:url('yuyue_info')}?id=" + data.id
				});
			}

			// look_info 详情
			if (obj.event === 'look_info') {
				layer.open({
				  title:false
				  , shadeClose: true
				  , shade: 0.5
				  , type: 2,
				  skin:"open_allview"
				  , area: ['100%',	'100%']
				  , content: "{:url('look_info')}?id=" + data.id
				});
			}
			// report 汇报记录
			if (obj.event === 'report') {
				layer.open({
				  title:false
				  , shadeClose: true
				  , shade: 0.5
				  , type: 2,
				  skin:"open_allview"
				  , area: ['60%',	'60%']
				  , content: "{:url('report')}?id=" + data.id
				});
			}
			// 审核报价
			if (obj.event === 'offer') {
				layer.open({
				  title:false
				  , shadeClose: true
				  , shade: 0.5
				  , type: 2,
				  skin:"open_allview"
				  , area: ['60%',	'60%']
				  , content: "{:url('offer')}?id=" + data.id
				});
			}
			
        });
		$(".search-btn").click(function () {
          var keywords			=$("input[name='keywords']").val();
          var seach_time		=$("#seach_time").val();
          table.render({
            elem: '#tables', 
            url: "{:url('index_data')}?keywords="+keywords+"&seach_time="+seach_time,
            page: true,
            cols: lists
          });
          
        })
        table.render({
          elem: '#tables', 
          url: "{:url('index_data')}",
          page: true,
          cols: lists
        });

      });

    </script>
  </div>
</body>

</html>